const fs = require('fs')

function getfiles(path) {
	return fs.readdirSync(path, {
		encoding: 'utf8',
		withFileTypes: true
	})
}

function isFile(filepath) { //判断是否是文件 Boolean
	let stat = fs.statSync(filepath)
	return stat.isFile()
}

function isDir(filepath) { //判断是否是文件夹 Boolean
	let stat = fs.statSync(filepath)
	return stat.isDirectory()
}

function loadFile(path) {
	return fs.readFileSync(path, "utf-8")
}
module.exports = {
	getfiles,
	isDir,
	isFile,
	loadFile
}